package com.hdb;

import com.hdb.dao.Hidden;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by aszer on 2016/11/12.
 */
@Entity
@Table(name = "comment", schema = "testin", catalog = "")
public class TComment {
    private int commentId;
    private int goodId;
    private int userId;
    private String commentInfo;
    private Timestamp commentDate;
    @Hidden
    private int commentDel;

    @Id
    @Column(name = "comment_id", nullable = false)
    public int getCommentId() {
        return commentId;
    }

    public void setCommentId(int commentId) {
        this.commentId = commentId;
    }

    @Basic
    @Column(name = "good_id", nullable = false)
    public int getGoodId() {
        return goodId;
    }

    public void setGoodId(int goodId) {
        this.goodId = goodId;
    }

    @Basic
    @Column(name = "user_id", nullable = false)
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "comment_info", nullable = false, length = 1024)
    public String getCommentInfo() {
        return commentInfo;
    }

    public void setCommentInfo(String commentInfo) {
        this.commentInfo = commentInfo;
    }

    @Basic
    @Column(name = "comment_date", nullable = false)
    public Timestamp getCommentDate() {
        return commentDate;
    }

    public void setCommentDate(Timestamp commentDate) {
        this.commentDate = commentDate;
    }

    @Basic
    @Column(name = "comment_del", nullable = false)
    public int getCommentDel() {
        return commentDel;
    }

    public void setCommentDel(int commentDel) {
        this.commentDel = commentDel;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TComment tComment = (TComment) o;

        if (commentId != tComment.commentId) return false;
        if (goodId != tComment.goodId) return false;
        if (userId != tComment.userId) return false;
        if (commentDel != tComment.commentDel) return false;
        if (commentInfo != null ? !commentInfo.equals(tComment.commentInfo) : tComment.commentInfo != null)
            return false;
        if (commentDate != null ? !commentDate.equals(tComment.commentDate) : tComment.commentDate != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = commentId;
        result = 31 * result + goodId;
        result = 31 * result + userId;
        result = 31 * result + (commentInfo != null ? commentInfo.hashCode() : 0);
        result = 31 * result + (commentDate != null ? commentDate.hashCode() : 0);
        result = 31 * result + commentDel;
        return result;
    }
}
